Using the Multi Instances Feature
The Multi Instances functionality enables the Real-Time Client connectivity framework to connect to a specific instance of a given application, based on some characteristics of that instance.
For more details, refer to Multiple Instances of the Same Application.
For example, you have multiple Internet Explorer browsers (or multiple Tabs) that present a Google search, and you are interested in the number of search results returned, based on some search key. The methodology involves looping through the available instances of the Google search box to find the one with the corresponding search key. Once found, you can connect to the specific instance of Internet Explorer that contains this search box and retrieve the number of search results within that instance. Connecting to the correct instance may be achieved by using the function given in the steps below.
Let us go through the steps below to understand how to use this functionality. In these steps, we have captured a number of screen elements, built a function that accepts a search key as a parameter, loops through all instances of the Google search text box, and activates or locks an instance if the value equals the passed parameter value.
You can also refer to the sample project here.
To use the Multi-Instance functionality:
-
In Internet Explorer, open few instances of a Google search with different search results.
-
Capture the Google search box as screen elements and number of search results HTML element. Make the relevant screen elements visible.
-
For the Google search screen element, enable Has multiple instances.
-
Create a new function with type Text pSearchKey as input parameter.
-
Create a local variable instances as a List of type HTML TextBox.
-
Assign Get Instances of the Google search textbox into the instances local variable.
-
Add a For Each instruction to loop through all instances of the Google search textbox.
-
Inside the For Each instruction, add an If instruction.
-
Enter an If condition of Value of HTML TextBox - equals - pSearchKey.
-
Add an If Then instruction to Activate And Lock Instance of HTML TextBox.
-
Add an If Then instruction to Return.
- Save and execute the project.